@extends('layouts.appbook')

@section('content')
    <h1 class="mb-4">编辑书签</h1>
    <form action="{{ route('bookmarks.update', $bookmark->id) }}" method="POST">
        @csrf
        @method('PUT')
        <div class="mb-3">
            <label for="title" class="form-label">书签标题</label>
            <input type="text" name="title" id="title" class="form-control" value="{{ old('title', $bookmark->title) }}">
            @error('title')
                <div class="text-danger">{{ $message }}</div>
            @enderror
        </div>
        <div class="mb-3">
            <label for="url" class="form-label">URL</label>
            <input type="text" name="url" id="url" class="form-control" value="{{ old('url', $bookmark->url) }}">
            @error('url')
                <div class="text-danger">{{ $message }}</div>   
            @enderror
        </div>
        <button type="submit" class="btn btn-success">更新</button>
        <a href="{{ route('bookmarks.index') }}" class="btn btn-secondary">取消</a>
    </form>
@endsection